package com.caszx.chargingpile.holder.user;

import android.view.View;
import android.widget.TextView;

import com.app.base.adapter.holder.BaseHolder;
import com.caszx.chargingpile.R;
import com.caszx.chargingpile.entity.EntityMessage;
import com.makeramen.roundedimageview.RoundedImageView;

/**
 * Created by think on 2016/2/19.
 */
public class MessageHolder extends BaseHolder<EntityMessage> {



    RoundedImageView imag_dot;
    TextView txt_title;
    TextView txt_content;
    TextView txt_time;

    public MessageHolder(View view) {
        super(view);
    }

    @Override
    protected void initView() {

        imag_dot = (RoundedImageView) mRootView.findViewById(R.id.imag_dot);
        txt_title = (TextView) mRootView.findViewById(R.id.txt_title);
        txt_content = (TextView) mRootView.findViewById(R.id.txt_content);
        txt_time = (TextView) mRootView.findViewById(R.id.txt_time);

    }

    @Override
    protected void refreshView() {

        if(EntityMessage.MESG_READED == mItem.readMark){
            imag_dot.setVisibility(View.INVISIBLE);
        }else if(EntityMessage.MESG_UNREAD == mItem.readMark){
            imag_dot.setVisibility(View.VISIBLE);
        }

        txt_title.setText(mItem.title);
        txt_content.setText(mItem.note);
        txt_time.setText(mItem.recordTime);

    }
}
